 <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>查看个人信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
</head>
 <body>
    <form class="layui-form" action="" lay-filter="teacherDetail" id="teacherDetail">
        <div class="layui-form-item" style="visibility: hidden">
            <label class="layui-form-label">教师编号</label>
            <div class="layui-input-inline">
                <input type="text" name="id"  autocomplete="off" class="layui-input" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">科目</label>
            <div class="layui-input-inline">
                <select name="subjectId">
                    <option value=""></option>
                    <option value="1">语文</option>
                    <option value="2">数学</option>
                    <option value="3">英语</option>
                    <option value="4">物理</option>
                    <option value="5">化学</option>
                    <option value="6">生物</option>
                    <option value="7">地理</option>
                    <option value="8">历史</option>
                    <option value="9">政治</option>
                    <option value="10">体育</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-inline">
                <input type="text" name="teachersName" placeholder="请输入姓名" autocomplete="off" class="layui-input">
            </div>
            <label class="layui-form-label">性别</label>
            <div class="layui-input-block">
                <input type="radio" name="gender" value="1" title="男" checked="">
                <input type="radio" name="gender" value="2" title="女">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">身份</label>
            <div class="layui-input-inline">
                <select name="roleId" >
                    <option value=""></option>
                    <option value="1">学生</option>
                    <option value="2">班长</option>
                    <option value="3">家长</option>
                    <option value="4">家委</option>
                    <option value="5">老师</option>
                    <option value="6">班主任</option>
                    <option value="7">教务处主任</option>
                    <option value="8">招生办主任</option>
                    <option value="9">校长</option>
                </select>
            </div>
            <label class="layui-form-label">政治面貌</label>
            <div class="layui-input-inline">
                <input type="text" name="political" lay-verify="required" lay-reqText="请输入正确的政治面貌" placeholder="请输入政治面貌" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">证件类型</label>
            <div class="layui-input-inline">
                <select name="certificateId">
                    <option value="">请选择证件类型</option>
                    <option value="1">二代身份证</option>
                    <option value="2">出生证</option>
                    <option value="3">护照</option>
                    <option value="4">士官证</option>
                    <option value="5">港澳通行证</option>
                </select>
            </div>
            <label class="layui-form-label">证件号码</label>
            <div class="layui-input-inline">
                <input type="text" name="certificateNum" lay-verify="required" lay-reqText="请输入正确的证件号码" placeholder="请输入证件号码" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">地址</label>
            <div class="layui-input-inline">
                <input type="text" name="address" lay-verify="required" lay-reqText="请输入正确的地址" placeholder="请输入地址" autocomplete="off" class="layui-input">
            </div>
            <label class="layui-form-label">毕业院校</label>
            <div class="layui-input-inline">
                <input type="text" name="graduationName" lay-verify="required" lay-reqText="请输入正确的毕业院校" placeholder="请输入毕业院校" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">职称</label>
            <div class="layui-input-inline">
                <select name="professionalId">
                    <option value="">职称</option>
                    <option value="1">正高级</option>
                    <option value="2">高级</option>
                    <option value="3">一级</option>
                    <option value="4">二级</option>
                    <option value="5">三级</option>
                </select>
            </div>
            <label class="layui-form-label">科目</label>
            <div class="layui-input-inline">
                <select name="subjectId">
                    <option value=""></option>
                    <option value="1">语文</option>
                    <option value="2">数学</option>
                    <option value="3">英语</option>
                    <option value="4">物理</option>
                    <option value="5">化学</option>
                    <option value="6">生物</option>
                    <option value="7">地理</option>
                    <option value="8">历史</option>
                    <option value="9">政治</option>
                    <option value="10">体育</option>
                </select>
            </div>
        </div>

        <div class="layui-form-item" style="text-align: center">
            <label class="layui-form-label">上级老师</label>
            <div class="layui-input-inline">
                <select name="leader">
                    <option value=""></option>
                    <option value="1">文章</option>
                    <option value="3">数学王者</option>
                    <option value="4">物理大神</option>
                    <option value="5">化学牛人</option>
                    <option value="7">生物教授</option>
                    <option value="9">历史时钟</option>
                    <option value="10">政治角斗士</option>
                    <option value="13">地理游客</option>
                    <option value="15">体育达人</option>
                    <option value="16">英语健将</option>
                    <option value="17">杂家</option>
                    <option value="19">全才</option>
                </select>
            </div>

            <label class="layui-form-label">电话</label>
            <div class="layui-input-inline">
                <input type="text" name="phone" lay-verify="required | phone" lay-reqText="请输入正确的电话" placeholder="请输入电话" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" style="text-align: center">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-inline">
                <input type="text" name="password" lay-verify="required" lay-reqText="请输入正确的密码" placeholder="请输入密码" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item" style="text-align: center">
            <button  class="layui-btn" lay-submit lay-filter="doUpdate">修改</button>
            <button  class="layui-btn" lay-submit lay-filter="doReset">重置</button>
        </div>
    </form>
 </body>
<script>
    layui.use('form',function () {
        let form=layui.form;
        $.post("/teacher/queryTeacher",function (res) {
            form.val("teacherDetail", res.data.items[0]);
        });

        //监听修改事件
        form.on("submit(doUpdate)",function (data) {
            $.post("/teacher/modifyTeacher",data.field,function (res) {
                if (res.success=="true"){
                    layer.alert("修改成功！",{icon:6,time:2000});

                    $.post("/student/queryTeacher",function (res) {
                        form.render();
                        console.log(res.data.items);
                        form.val("teacherDetail", res.data.items);
                    });
                }
            });
            return false;
        });
        form.on("submit(doReset)",function () {
            $("#teacherDetail")[0].reset();
            form.render();
            return false;
        })
    })
</script>
</html>